package com.thb.pay.controller;


import com.thb.pay.api.agent.AgentAccountHistoryServiceApi;
import com.thb.pay.core.utils.PageResult;
import com.thb.pay.service.AgentAccountHistoryService;
import com.thb.pay.vo.req.AgentAccountHistoryPageReq;
import com.thb.pay.vo.req.AgentAccountHistoryReq;
import com.thb.pay.vo.resp.AgentAccountHistoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 代理商-账户-流水表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@RestController
public class AgentAccountHistoryController implements AgentAccountHistoryServiceApi {


    @Autowired
    private AgentAccountHistoryService agentAccountHistoryService;

    @Override
    public PageResult<AgentAccountHistoryVo> findPage(@RequestBody AgentAccountHistoryPageReq pageReq) {
        return agentAccountHistoryService.findPage(pageReq);
    }

    @Override
    public int count(@RequestBody AgentAccountHistoryReq agentAccountHistoryReq) {
        return agentAccountHistoryService.count(agentAccountHistoryReq);
    }

    @Override
    public AgentAccountHistoryVo getById(@RequestParam("id") Long id) {
        return agentAccountHistoryService.getById(id);
    }

    @Override
    public AgentAccountHistoryVo getByAgentIdAndId(@RequestParam("agentId") Long agentId, @RequestParam("id") Long id) {
        return agentAccountHistoryService.getByAgentIdAndId(agentId, id);
    }

    @Override
    public List<Map<String, Object>> countAgentProfit(@RequestParam("agentId") Long agentId) {
        return agentAccountHistoryService.countAgentProfit(agentId);
    }
}
